package com.kuang.service;


import com.kuang.mapper.UserMapper;
import com.kuang.service.UserService;
import com.kuang.springcloud.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public User getUserByName(String uername) {
        return userMapper.getUserByName(uername);
    }

    @Override
    public List<User> getUsers() {
        return userMapper.getUsers();
    }


    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }


    @Override
    public String findAvatar(Integer id) {
        String avatar = userMapper.findAvatarById(id);
//        System.out.println(avatar);
        return avatar;
    }

    @Override
    public String findRealname(Integer id) {
        return userMapper.findRealnameById(id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public int updateUserAvatar(Integer uid, String avatar) {
        return userMapper.updateUserAvatar(uid,avatar);
    }

    @Override
    public Boolean isAvatarExist(Integer uid) {
        return userMapper.isAvatarExist(uid);
    }

    @Override
    public User findUseByUID(Integer uid) {
        return userMapper.findUseByUID(uid);
    }


}
